<?php
/**
 * 统计
 *
 * User: kaikaic
 * Date: 2018/11/30
 * Time: 15:23
 */

namespace app\exam\controller;

use app\exam\model\SyncMecModel;
use app\exam\service\CityService;
use app\exam\service\MecService;
use controller\BasicAdmin;
use service\ConfigService;
use service\ToolsService;
use think\Db;

class Stats extends BasicAdmin {

    protected $table = "StatisticsTotal";

    public function index() {
        $this->title = "数据统计";

        $db = Db::name($this->table);
        $date = $this->request->param("date");
        if ($date) {
            $date = strtotime($date);
            $db->where(['create_time'=>$date]);
        }

        return parent::listRecord($db);
    }

    /**
     * 每日订单数据
     */
    public function order() {
        $this->title = "数据统计";

        $db = Db::name("StatisticsOrder");
        $date = $this->request->param("date");
        if ($date) {
            $date = strtotime($date);
            $db->where(['create_time'=>$date]);
        }

        return parent::listRecord($db, "StatisticsOrder", true, "", "order");
    }
}

